var spawn = require('child_process').spawn;
const path = require('path')
const child = spawn('node', ['./test.js']);
var response = ''
child.stdout.on('data', function( buffer ){ response += buffer.toString(); })
child.stdout.on('end', function(){ console.log(response) });


const child2 = spawn('node', ['../test.js'], { // 注意这里和上面的区别
  cwd: path.resolve(__dirname, 'otherfolder')
  // cwd: 'E://workbenchnode//test//process//otherfolder'
});
var response2 = ''
child2.stdout.on('data', function( buffer ){ response2 += buffer.toString(); })
child2.stdout.on('end', function(){ console.log(response2) });
child2.stdout.on('error', function(err){ console.log(err) });
